import request from '@/config/axios'

export interface AssetRepairVO {
  id: string
  businessCode: string
  procId: string
  status: string
  name: string
  repairStatus: string
  type: string
  planFinishDate: localdate
  actualFinishDate: localdate
  content: string
  reportUserId: string
  reportUserName: string
  pictureId: string
  originatorId: string
  businessDate: localdate
}

// 查询资产报修分页
export const getAssetRepairPage = async (params) => {
  return await request.get({ url: `/eam/asset-repair/page`, params })
}

// 查询资产报修详情
export const getAssetRepair = async (id: number) => {
  return await request.get({ url: `/eam/repair-order/get?id=` + id })
}

// 查询资产报修详情 流程详情
export const getOrderDetail = async (params: any) => {
  return await request.get({ url: `/eam/repair-order/getOrderDetail`, params})
}

// 新增资产报修
export const createAssetRepair = async (data: AssetRepairVO) => {
  return await request.post({ url: `/eam/asset-repair/create`, data })
}

// 修改资产报修
export const updateAssetRepair = async (data: AssetRepairVO) => {
  return await request.put({ url: `/eam/asset-repair/update`, data })
}

// 删除资产报修
export const deleteAssetRepair = async (id: number) => {
  return await request.delete({ url: `/eam/asset-repair/delete?id=` + id })
}

// 导出资产报修 Excel
export const exportAssetRepair = async (params) => {
  return await request.download({ url: `/eam/asset-repair/export-excel`, params })
}

export const getAssetRepairParts = async (id: number) => {
  return await request.get({ url: `/eam/repair-sp/page?id=` + id })
}

